const path = require("path");
module.exports = {
  configureWebpack: {
    resolve: {
      /* 为路径配置别名 */
      alias: {
        assets: "@/assets",
        common: "@/common",
        components: "@/components",
        network: "@/network",
        views: "@/views",
        store: "@/store"
      }
    }
  },
  publicPath: "/",
  //配置跨域请求
  devServer: {
    contentBase: path.join(__dirname, "src"),
    open: true, //是否自动打开浏览器
    // https: false, //是否开启https
    // hotOnly: false,
    proxy: {
      // 配置跨域
      /***
       * 产品模块
       */
      "/apiproduct": {
        // target: "http://10.1.188.6:9000", //
        // target: "http://10.1.188.69:9000", //请求接口域名
        target: "http://10.2.48.57:9000",
        ws: true,
        // secure: false,
        changOrigin: true, //是否允许跨越
        pathRewrite: {
          "^/apiproduct": ""
        }
      },
      /***
       * 订单模块
       */
      "/apiorder": {
        // 10.44.74.211
        // target: "http://10.1.188.69:10000", //请求接口域名
        // target: "http://10.1.188.6:10000", //
        target: "http://10.2.48.57:10000",
        ws: true,
        // secure: false,
        changOrigin: true, //是否允许跨越
        pathRewrite: {
          "^/apiorder": ""
        }
      },

      /**
       * 头像模块
       */
      "/apih": {
        // target: "http://10.1.188.69:8081", //请求接口域名
        target: "http://10.1.188.6:7000", //请求接口域名
        ws: true,
        // secure: false,
        changOrigin: true, //是否允许跨越
        pathRewrite: {
          "^/apih": ""
        }
      },

      /**
       * 登录注册支付模块
       */
      "/api": {
        //target: "http://119.23.68.127:80",
        // target: "http://10.1.188.69:7000", //请求接口域名
        target: "http://10.1.188.6:7000", //请求接口域名
        ws: true,
        // secure: false,
        changOrigin: true, //是否允许跨越
        pathRewrite: {
          "^/api": ""
        }
      },

      /**
       * 个人信息认证模块
       */
      "/identity": {
        target: "http://10.1.188.6:7000", //请求接口域名
        ws: true,
        // secure: false,
        changOrigin: true, //是否允许跨越
        pathRewrite: {
          "^/identity": ""
        }
      },

      /**
       * 公益捐赠模块
       */
      "/msglen": {
        // target: "http://10.1.188.69:12000",
        target: "http://10.1.188.6:12000", //请求接口域名
        //target: "http://119.23.68.127:80", //请求接口域名
        ws: true,
        secure: false,
        changOrigin: true, //是否允许跨越
        pathRewrite: {
          "^/msglen": ""
        }
      },

      /**
       * 众筹模块
       */
      "/crowd": {
        // target: "http://10.1.188.69:8095",
        target: "http://10.1.188.6:11000",
        // target: "http://119.23.68.127", //请求接口域名
        ws: true,
        // secure: false,
        changOrigin: true, //是否允许跨越
        pathRewrite: {
          "^/crowd": "/"
        }
      }
      //   "/apiProduct": {
      //     target: "http://10.2.48.57:9000", //请求接口域名
      //     ws: false,
      //     secure: false,
      //     changOrigin: true, //是否允许跨越
      //     pathRewrite: {
      //       "^/apiProduct": ""
      //     }
      //   }
    },
    before: app => {}
  }
};
